from pydantic_settings import BaseSettings
from typing import Optional

class Settings(BaseSettings):
    # 数据库配置
    MYSQL_HOST: str = "127.0.0.1"
    MYSQL_PORT: int = 3307
    MYSQL_USER: str = "root"
    MYSQL_PASSWORD: str = "root"
    MYSQL_DB: str = "knowledge_graph"
    
    # Redis配置
    REDIS_HOST: str = "127.0.0.1"
    REDIS_PORT: int = 6379
    REDIS_PASSWORD: str = "123456"
    REDIS_DB: int = 11
    
    # JWT配置
    SECRET_KEY: str = "your-secret-key"  # 生产环境应该使用更安全的密钥
    ALGORITHM: str = "HS256"
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24  # 24小时
    
    # CORS配置
    CORS_ORIGINS: list = ["http://localhost:5173"]
    
    # API配置
    API_V1_STR: str = "/api/v1"
    PROJECT_NAME: str = "Knowledge Graph API"

    class Config:
        env_file = ".env"

settings = Settings() 